package com.example.day8_sp;

import android.content.Context;
import android.content.SharedPreferences;

public class SPUtils {
    public static SharedPreferences sp;
    public static SharedPreferences init(Context context){
        sp = context.getSharedPreferences("2208",Context.MODE_PRIVATE);
        return sp;
    }
    //存入数据
    public static void put(String key,String name){
        sp.edit().putString(key,name).commit();
    }
    //读取数据 所有默认返回值均为空
    public static String get(String key){
        return sp.getString(key,"");
    }

}
